import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import path from 'path'

// https://vite.dev/config/
export default defineConfig({
  plugins: [vue()],
  css: {
    preprocessorOptions: {
      scss: {
        additionalData: '@use "@/styles/element/index.module.scss" as *;'
      }
    }
  },
  base: '/food-hub/',
  resolve: {
    // 配置路径别名
    alias: {
      '@': path.resolve(__dirname, './src')
    }
  },
  server: {
    proxy: {
      '/food-api': {
        target: 'http://127.0.0.1:8083',
        changeOrigin: true,
        rewrite: (item) => item.replace(/^\/food-api/, '')
      }
    }
  }
})
